home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 233 / Computer Shopper 233 / ComputerShopperDVD233.iso / Toolkit / Office / Jot / JOTP.EXE / {app} / extras / jot1.js next >
Encoding:
JavaScript  |  2003-06-30  |  1.1 KB  |  38 lines

  1. // jot1.js
  2. // A simple Windows JScript script demonstrating Jot+ Notes' Automation
  3. // interfaces. It loads a notefile (filename hard-coded) and prints the
  4. // titles of every note.
  5. // usage: cscript jot1.js
  6. // You will need to update the jotApp.Load line appropriately
  7.  
  8. var jotApp = new ActiveXObject("JotPlus.JotApplication");
  9. jotApp.Visible = false;
  10.  
  11. // PrintNote
  12. // Recursively prints a note's details
  13. function PrintNote(note)
  14. {
  15.     // Print this note's ID and Title:
  16.     WScript.StdOut.WriteLine( note.ID + ': '+note.Title );
  17.  
  18.     // Now iterate over this note's children to print them:
  19.     var e = new Enumerator(note.Children);
  20.     for (;!e.atEnd();e.moveNext())
  21.     {
  22.         PrintNote( e.item() );
  23.     }
  24. }
  25.  
  26. // Load a sample notefile:
  27. jotApp.Load( "z:\\jot\\holmes.jot3", true );
  28.  
  29. // Display some details about the notefile:
  30. var doc = jotApp.ActiveDocument;
  31. WScript.StdOut.WriteLine( "Filename: "+doc.FullName);
  32. WScript.StdOut.WriteLine( "Title: "+doc.Title);
  33.  
  34. // Now display the titles of all notes:
  35. PrintNote( doc.Root );
  36.  
  37. WScript.StdOut.WriteLine( "DONE." );
  38.